package com.jic.manager.controller.feign;

import com.jic.common.base.vo.RestResult;
import com.jic.manager.api.rest.AnnouncementApi;
import com.jic.manager.response.SysNoticeResponse;
import com.jic.manager.service.SysNoticeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName AnnouncementFeign
 * TODO
 * @Description
 * @Author chenhongfeng
 * @Date 2020/11/28 15:36
 * @Version 1.0
 **/
@RestController
@RequestMapping("announcement")
public class AnnouncementFeign implements AnnouncementApi {
    @Autowired
    SysNoticeService sysNoticeService;

    /**
     * 公告
     * @return
     */
    @PostMapping("listPage")
    @ApiOperation("查询公告")
    @Override
    public RestResult<List<SysNoticeResponse>> getAnnouncement() {
        List<SysNoticeResponse> timeSort = sysNoticeService.getTimeSort();

        if(timeSort==null){
            RestResult.error("200004","没有公告");
        }

        return RestResult.success(timeSort);
    }
}
